package com.android.support.lib.universal.sdk.alipay;

import com.android.support.lib.universal.R;
import com.android.support.lib.universal.sdk.alipay.libray.AlipayManager;
import com.android.support.lib.universal.sdk.alipay.libray.AlipayManager.AlipayManagerListener;

import android.app.Activity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;

public class AlipayActivity extends Activity implements OnClickListener {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.lib_activity_sdk_alipay);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub

		if(v.getId()==R.id.btn_alipay){
			// 支付
			AlipayManager.getInstance(this).pay("商品名", "商品描述", "0.01",
					System.currentTimeMillis() + "");
			// 支付回调
			AlipayManager.getInstance(this).setAlipayManagerListener(
					new AlipayManagerListener() {
						@Override
						public void onPaySuccess() {
							Log.e("test", "支付成功");
						}

						@Override
						public void onPayFailed() {
							Log.e("test", "支付失败");
						}
					});
		}
	}
}
